/*!
 * FileName: luogu-1638.cpp
 * This Problem is on luogu. The ID of the problem is 1638. 
 * Copyright(c) 2019 Shu_Yu_Mo
 * MIT Licensed
 * Luogu: https://www.luogu.org/space/show?uid=44615
 * Github: https://github.com/oldsuold/
 * Gitee: https://gitee.com/Shu_Yu_Mo/
 * These words were created by an amazing tool written by Shu_Yu_Mo.
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstring>
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#define inf 0x7fffffff
using namespace std;
const int _ = 1000100;
const int _M = 2010;
int A[_];
inline int read()
{
    char c = getchar(); int sign = 1; int x = 0;
    while(c > '9' || c < '0') { if(c=='-')sign = -1; c = getchar(); } 
    while(c <= '9' && c >= '0') { x *= 10; x += c - '0'; c = getchar(); }
    return x * sign;
}
int n, m;
int sum = 0;
int book[_M];
void del(int x)
{
	book[x] --;
	if(book[x] == 0) sum --;
}
void add(int x)
{
	book[x] ++;
	if(book[x] == 1) sum ++;
}
int main()
{
//	freopen("test.in.txt", "r", stdin);
	memset(book, 0, sizeof(book));
	n = read(); m = read();
	for(register int i = 1;i <= n;i++) A[i] = read();
	int l = n, r = n; add(A[n]);
	int ansA;
	int ansB;
	int MinC = inf;
	while(l <= r)
	{
//		printf("[%d, %d] , sum = %d\n", l, r, sum);
		
		while(sum < m && l > 1) add(A[--l]);
		if(r - l <= MinC && sum == m && l > 0 && r > 0)
		{
//			printf("updated [%d, %d], sum = %d\n", l, r, sum);
			MinC = r - l;
			ansA = l;
			ansB = r;
		}
		if(sum != m) break;
		del(A[r--]);
		if(r < 1) break;
	}
	printf("%d %d", ansA, ansB);
    return 0;
}
